	
 
 //搜索附近的POI名称，未完善
 const amap = uniCloud.importObject('uni-map-co',{customUI:true});
 import store from '../store';
	export default	async function searchPoi(keyword, location) {
		
		
			const customLocation =  {
				lng: location.longitude || 116.404,
				lat: location.latitude || 39.915
			};

			try {
				const searchData = {
					keyword: keyword,
					location: customLocation,
					radius: 100, // 搜索半径5km
					auto_extend: 1,
					get_subpois: true,
					orderby: 'distance', // 按距离排序
					page_index: 1,
					page_size: 20,
					types: '120000', // 地址类POI
					city: ''
				};
				const res = await amap.search(searchData);
				console.log('附近地址', res);
				this.nearbylist = (res.result?.result?.data || []).filter((item) => item.address && item.title).sort((a, b) => a.distance - b.distance);
				
			} catch (e) {
				console.warn('获取附近地址失败:', e.message);
				this.nearbylist = [];
				this.locationText = '获取附近地址失败';
			}
		}